package com.twotwoshop.service.search.controller;


import com.twotwoshop.domin.common.dtos.ResponseResult;
import com.twotwoshop.domin.goods.dtos.GoodsSearchDto;
import com.twotwoshop.service.search.service.GoodsSearchService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/search")
@RequiredArgsConstructor
public class GoodsSearchController {


    private final GoodsSearchService goodsSearchService;


    /**
     *
     * 搜索文章
     *
     * @param goodsSearchDto
     * @return
     */
    @PostMapping("/goods")
    public ResponseResult search(@RequestBody GoodsSearchDto goodsSearchDto){

        log.info("es搜索文章...{}",goodsSearchDto);

        return goodsSearchService.search(goodsSearchDto);
    }
}
